<template>
  <div class="searchItem">
    <div @click="skipClick" v-if="item.cover.images.length >= 2">
      <div class="title">{{ item.title }}</div>
      <div class="img" v-if="item.cover.images.length > 0">
        <van-image
          v-for="(item1, index1) in item.cover.images"
          :key="index1"
          :src="item1"
          alt=""
          lazy-load
        >
          <template v-slot:error>加载失败</template>
          <template v-slot:loading>
            <van-loading type="spinner" size="20" />
          </template>
        </van-image>
      </div>
      <div class="bottmoBox">
        <div class="info">
          <div class="i1">{{ item.aut_name }}</div>
          <div class="i2">{{ item.comm_count }}评论</div>
          <div class="i3">{{ item.pubdate | fromtime }}</div>
        </div>
        <!-- <div class="bottom">
          <div class="b1">
            <van-icon name="edit"></van-icon>
            <div class="txt">{{ item.comm_count }}</div>
          </div>
          <div class="b1">
            <van-icon name="good-job-o"></van-icon>
            <div class="txt">点赞</div>
          </div>
          <div class="b1">
            <van-icon name="point-gift-o"></van-icon>
            <div class="txt">分享</div>
          </div>
        </div> -->
      </div>
    </div>
    <div class="cell2" @click="skipClick" v-else>
      <div class="left-box">
        <div class="title">{{ item.title }}</div>
        <div class="bottmoBox">
          <div class="info">
            <div class="i1">{{ item.aut_name }}</div>
            <div class="i2">{{ item.comm_count }}评论</div>
            <div class="i3">{{ item.pubdate | fromtime }}</div>
          </div>
          <!-- <div class="bottom">
            <div class="b1">
              <van-icon name="edit"></van-icon>
              <div class="txt">{{ item.comm_count }}</div>
            </div>
            <div class="b1">
              <van-icon name="good-job-o"></van-icon>
              <div class="txt">点赞</div>
            </div>
            <div class="b1">
              <van-icon name="point-gift-o"></van-icon>
              <div class="txt">分享</div>
            </div>
          </div> -->
        </div>
      </div>
      <div class="right-box">
        <div class="img" v-if="item.cover.images.length > 0">
          <van-image
            v-for="(item1, index1) in item.cover.images"
            :key="index1"
            :src="item1"
            alt=""
            lazy-load
          >
            <template v-slot:error>加载失败</template>
            <template v-slot:loading>
              <van-loading type="spinner" size="20" />
            </template>
          </van-image>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Vue from 'vue'
import { Lazyload } from 'vant'
Vue.use(Lazyload)
export default {
  name: 'searchItem',
  props: {
    item: {
      type: Object
    }
  },
  methods: {
    skipClick () {
      this.$emit('skipClick')
    }
  }
}
</script>

<style lang="less" scoped>
.searchItem {
  .title {
    font-size: 16px;
    margin: 15px 0;
  }
  .img {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    .van-image {
      height: 80px;
      width: 110px;
      &:nth-child(2) {
        margin: 0 6px;
      }
    }
  }
  .info {
    display: flex;
    align-items: center;
    font-size: 12px;
    margin-bottom: 5px;
    .i2 {
      margin: 0 16px;
    }
  }
  .bottom {
    display: flex;
    justify-content: space-between;
    .van-icon {
      font-size: 16px;
      margin-right: 5px;
    }
    .b1 {
      display: flex;
      align-items: center;
      margin-left: 4px;
    }
    .txt {
      font-size: 12px;
    }
  }
  .bottmoBox {
    display: flex;
    justify-content: space-between;
    color: #ccc;
    margin-top: 25px;
  }
  .cell2 {
    display: flex;
    justify-content: space-between;
    .left-Box {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      .bottmoBox {
        margin-top: 40px;
      }
      // align-items: space-between;
    }
    .right-Box {
      .img {
        display: flex;
        justify-content: space-between;
        margin: 15px 0;
        .van-image {
          height: 80px;
          width: 110px;
        }
      }
    }
  }
}
</style>
